package com.wanhe.mealbookmodule;

import android.os.Environment;

import java.io.File;

/**
 * Created by Administrator on 2016/5/19.
 */
public class Const {

	public static final String	ANIMATE_ACTION		= "www.wanhe.com";
	public static final String	ANIMATE_LOCATION_X	= "locationX";
	public static final String	ANIMATE_LOCATION_Y	= "locationY";

	// 用于显示二级菜单页面的广播
	public static final String	SHOW_SECLEVEL_DIALOG_ACTION	= "www.wanhe.show_dialog";
	public static final String	DISH_ID						= "dish_id";
	public static final String	IS_SETMEAL					= "isSetmeal";

	public static final String	IPKey		= "IP";
	public static final String	PORTKey		= "PORT";
	public static final String	HOST		= "http://"
			+ SettingFactory.getInstance().getSharedPreferences()
					.getString(IPKey, "")
			+ ":" + SettingFactory.getInstance().getSharedPreferences()
					.getString(PORTKey, "");
	public static final String	BASE_URL	= HOST + "/GetData";
	public static final String	ACT_PARAM	= "act=";
	public static final String	_PARAM		= "_=";
	public static final String	ID_PARAM	= "id=";

	public static final String AND = "&";

	public static final String	ACT_GET_DESIGNDATA	= "getdesigndata";
	public static final String	ACT_GET_MENUDATA	= "getmenudata";

	public static final String	ORDERBROAD	= "com.wanhe.broadcast.progress";
	public static final String	ORDERSTATE	= "state";

	/**
	 * 获取菜品数据
	 */
	public static final String GET_FOOD_TYPE_DESIGN_DATA = BASE_URL + ID_PARAM
			+ "%s" + AND + ACT_PARAM + ACT_GET_DESIGNDATA + AND + _PARAM
			+ "1463539920374";

	public static final String	IMAGE_URL				= HOST + "%s" + "//"
			+ "%s/%s";
	public static final String	GET_FOOD_TYPE_MENU_DATA	= BASE_URL + ID_PARAM
			+ "%s" + AND + ACT_PARAM + ACT_GET_MENUDATA + AND + _PARAM
			+ "1463539920374";

	public static final String	PAGE_CHANGE_ACTION	= "com.dearport.page_change";
	public static final String	CURRENT_PAGE		= "current_page";
	public static final String	PAY					= "http://wap2.51k7.com/Padqrcode.aspx?Rid=%s";

	public static final String	VIDEO_CHANGE_ACTION	= "com.dearport.video_change";
	public static final String	VIDEO_ITEM			= "video_item";

	// glView显示还是隐藏action
	public static final String	GLVIEW_SHOW_ACTION	= "GLView_show";
	public static final String	GLVIEW_GONE_ACTION	= "GLView_gone";
	public static final String	CLOSE_APP			= "close_app";

	// 视频控件失去焦点的广播
	public static final String	MENU_RESUME	= "menu_resume";
	public static final String	MENU_Pause	= "menu_pause";

	// 内存较低时发送的广播，用于做回收
	public static final String	LOW_MEMORY				= "low_memory";
	public static final String	DEMONSTRATION			= "demonstration";
	public static int			PINGGUO_PAGE_POSITION	= -1;				// 用于记录拼锅页面的静态全局变量。如果值为-1不做任何操作

	public static String	FIRST_PAGE_VIDEO_PATH;
	public static float		COUNTER_Z_LEVEL			= Float.MAX_VALUE - 1;
	public static float		TEXTER_Z_LEVEL			= Float.MAX_VALUE - 1;
	public static float		VIDEO_Z_LEVEL			= Float.MAX_VALUE;
	public static boolean	isShowedFirstPageVideo	= false;

	public static String generateImageUrl(String shopID, String floderName,
			String fileName) {
		String url = String.format(IMAGE_URL, floderName, shopID, fileName);
		return url;
	}

	public static String getHostAddress() {
		return HOST;
	}

	public static String getMenuDataImage(String fileName) {
		String url = getHostAddress() + GET_IMAGE + "/menu_image/" + "%s";
		url = String.format(url, fileName);
		return url;
	}

	/**
	 * ==================================================测试
	 * 相关=============================================================
	 */
	public static final String TEST_HOST = "http://10.0.1.218:8022";

	public static final String	GET_DATA	= "/GetData";
	public static final String	GET_IMAGE	= "/GetImage";

	public static final String	S_IMAGE	= "/s_image/";
	public static final String	B_IMAGE	= "/b_image/";

	public static final String GET_MEMBER = "/GetMember";

	/**
	 * ==================================================本地硬件配置=============================================================
	 */

	public static final String	CLIENT_UUID		= "client_uuid";
	public static final String	SOCKET_PASSWORD	= "client_psw";
	public static final String	ORDER_FLOWID	= "order_flowid";

	public static final String	WANHE	= "com.wanhe";
	public static final String	SHOP_ID	= "shopid";

	public static final String	SOCKET_IP	= "139.129.131.149";
	public static final String	SOCKET_POST	= "8088";

	public static final String SOCKET_TEST_IP = "10.0.1.218"; // 晓亮机器
	// public static final String SOCKET_TEST_IP = "10.0.1.225";//铭桦机器
	public static final String SOCKET_TEST_POST = "8400";

	/**
	 * 根据
	 *
	 * @param dishID
	 * @return
	 */
	public static String generateSecLevelImageUrl(String dishID) {
		dishID = dishID.trim();
		String url = String.format(
				getHostAddress() + GET_IMAGE + B_IMAGE + "%s" + ".jpg", dishID);
		url = url.trim();
		return url;
	}

	/**
	 * 本地视频的路径
	 *
	 * @author 陈德基 created at 2016/9/27 14:10
	 */
	public static final String fileBaseUrl = Environment
			.getExternalStorageDirectory().getPath() + File.separator + "Wanhe"
			+ File.separator + "Dearport";

	public static final String videoBaseUrl = fileBaseUrl + File.separator
			+ "videos" + File.separator;

	public static final String imageBaseUrl = fileBaseUrl + File.separator
			+ "image" + File.separator;

	public static final String gifBaseUrl = fileBaseUrl + File.separator + "gif"
			+ File.separator;

	public static final String cacheBaseUrl = fileBaseUrl + File.separator
			+ "cache" + File.separator;

	public static final String callRingUrl = fileBaseUrl + File.separator
			+ "callRing.txt";

	/**
	 * 设计器缓存数据文件
	 *
	 * @author 陈德基 create at 2017/4/20 11:21
	 */
	public static final String DISIGN_CACHE_FILE_NAME = "disgn.obj";

	/**
	 * 菜品数据缓存数据文件
	 *
	 * @author 陈德基 create at 2017/4/20 11:21
	 */
	public static final String DISH_CACHE_FILE_NAME = "dish.obj";

	/**
	 * 估清数据缓存文件名称
	 *
	 * @author 陈德基 create at 2017/4/21 16:30
	 */
	public static final String SALLOUT_CACHE = "sallout.obj";

	public static final String IMG_CACHE = cacheBaseUrl + File.separator
			+ "img";

	/**
	 * ==================================================第三方银联生成二维码
	 * 相关的参数=============================================================
	 */
	// 测试接口
	public static final String CHECKPAY = "http://umspay.izhong.me/netpay-route-server/api/";
	// 正式接口
	public static final String FACTPAYURL = "https://mpos.quanminfu.com:9898/netpay-route-server/api/";

	public static final String	MSGSRC			= "DAFENGSHOU_CB";
	public static final String	MSGTYPE			= "bills.getQRCode";
	public static final String	MSGCLOSETYPE	= "bills.closeQRCode";
	public static final String	MID				= "123456789054321";	// 商户号
	public static final String	TID				= "88880001";
	public static final String	INSTMID			= "QRPAYDEFAULT";
	public static final String	SYSTEMID		= "3034";

	// 秘钥
	public static final String WANGHEKEY = "YbHMzRNcBBnznR3XsH8JzPQ78TKbdKatzHCsBbi6nTTF6wCY";
	// 支付结果通知地址
	public static final String NOTIFYURL = "http://eee.51k7.com/UnionpaySuccess.aspx";

	public static void reset() {
		FIRST_PAGE_VIDEO_PATH = null;
		isShowedFirstPageVideo = false;
	}
}
